/***************************************************************************
 *   This file is part of KTagger                                          *
 *   Copyright (C) 2010 by Luca Bellonda                                   *
 *   lbellonda _at_ gmail.com                                              *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/


#ifndef H_PLASMA_APPLET_PRIVATE
#define H_PLASMA_APPLET_PRIVATE
#include <KIcon>
#include <climits>

#include <QDBusInterface>
#include <QDBusReply>
#include <QPushButton>

#include <plasma/corona.h>
#include <plasma/widgets/iconwidget.h>

//#include <QPropertyAnimation>

#include <QGraphicsSceneHoverEvent>
#include <QGraphicsLinearLayout>

#include <Plasma/Applet>
#include <Plasma/Animator>
#include <Plasma/DataEngine>
#include <Plasma/PopupApplet>
#include <Plasma/IconWidget>
#include <Plasma/Label>

#include "KTaggerApplet.h"
#include "AssignTagWorker.h"
#include "ktagicon.h"

#include "ktagger_interface.h"

class KTaggerApplet::Private : public QObject
{

    Q_OBJECT;

    enum States {

        AVAILABLE,
        TAGGING,
        SEARCHING,
        CONFIGURING,
        CHOOSING
    } ;

    QString _mainIcon;
    KTaggerApplet* _owner;
    AssignTagsWorker    _workerThread;
    QString     _currentActivity;
    /** current state
      */
    States  _state;
    bool _inited;

    // User Interface
    QGraphicsLinearLayout   *_layout ;
    KTagIcon *_assignTagProfileIcon;
    KTagIcon *_assignOtherTagsIcon;
    QList<QAction*> _contextualActions;
    Plasma::Label   *_activityLabel;

    LogParam    _logParams;


    void initLog();

public slots:
    void assignClicked();
    void assignDone(const bool isError, const int errorCode, const QString &errorMessage);
    void assignProfileDone(const bool isError, const int errorCode, const QString &errorMessage);
private slots:
    void droppedFiles(const QStringList & fileList);
    void droppedFiles2(const QStringList & fileList);
    void doConfigure();
    void configurationDone();
    void doChooseProfile();

public:
    Private(KTaggerApplet * parent);
    ~Private();

    void init();
    bool canDoOperation();
    QList<QAction*> getContextualActions();
    void setCurrentActivity(const QString &activityName);

};

#endif  /*H_PLASMA_APPLET_PRIVATE*/
